package com.scau;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.scau.pojo.Admin;
import com.scau.util.SqlSessionFactoryUtil;

import org.apache.ibatis.session.SqlSession;

public class Test {
    public static void test(){
        SqlSession session = SqlSessionFactoryUtil.getSession();
        Admin admin = new Admin();
        admin.setId(2018);
        System.out.println(admin+"-----------------------");

        ObjectMapper jsonMapper = new ObjectMapper();
        String json;
		try {
			json = jsonMapper.writeValueAsString(admin);
			System.out.println(json);
		} catch (JsonProcessingException e) {
			e.printStackTrace();
		}
        
       //一定要加下面这两句，不然数据库不会更新
       session.commit();
       session.close();
       

    }
}
